package com.lagou.edu.course.controller;

import com.lagou.edu.dto.CourseDTO;
import com.lagou.edu.remote.CourseRemoteService;
import com.lagou.edu.response.ResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/course")
public class CourseController {

    @Autowired
    private CourseRemoteService courseRemoteService;

    @GetMapping("/getAllCourses")
    public ResponseDTO<List<CourseDTO>> getAllCourses() throws Exception{
        List<CourseDTO> courseList = courseRemoteService.getAllCourses();
        return ResponseDTO.success(courseList);
    }
}
